import axios from './axios'
import qs from 'qs'
import {apiUrl, appUrl} from '@/config/config'
export const addFaceResource = (data) => {
    return new Promise((resolve, reject) => {
        axios({
            url: apiUrl + '/face-recognition-service/device/face/resource/api',
            method: 'post',
            data
        }).then(res => {
          resolve(res.data)
        })
    })
}

export const detectFaceByUrl = (data) => {
    return new Promise((resolve, reject) => {
        axios({
            url: apiUrl + '/face-recognition-service/device/recognition/api/detectFaceByUrl',
            method: 'post',
            data
        }).then(res => {
          resolve(res.data)
        })
    })
}

export const checkUpdateFaceImage = (id) => {
    return new Promise((resolve, reject) => {
        axios({
            url: appUrl + '/bdc/api/app/teacher/' + id + '/checkUpdateFaceImage',
            method: 'post'
        }).then(res => {
          resolve(res.data)
        })
    })
}

export const getStudent = (id) => {
    return new Promise((resolve, reject) => {
        axios({
            url: appUrl + '/bdc/api/app/student/' + id,
            method: 'get',
          
        }).then(res => {
          resolve(res.data)
        })
    })
}

export const getTeacher = (id) => {
    return new Promise((resolve, reject) => {
        axios({
            url: appUrl + '/bdc/api/app/teacher/' + id,
            method: 'get',
         
        }).then(res => {
          resolve(res.data)
        })
    })
}

export const updateStudent = (data) => {
    return new Promise((resolve, reject) => {
        axios({
            url: appUrl + '/bdc/api/app/student/' + data.id,
            method: 'put',
            data
        }).then(res => {
          resolve(res.data)
        })
    })
}

export const updateTeacher = (data) => {
    return new Promise((resolve, reject) => {
        axios({
            url: appUrl + '/bdc/api/app/teacher/' + data.id,
            method: 'put',
            data
        }).then(res => {
          resolve(res.data)
        })
    })
}
